package com.study.dao.impl;

import com.study.dao.LoginDao;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * @author WS
 */
public class LoginDaoImpl extends HibernateDaoSupport implements LoginDao {
    @Override
    public Login checkLogin(String username, String password) {
        String[] str = {username, password};
        List list = this.getHibernateTemplate().find("from Login where name=? and password=?", str);
        Login login = null;
        if (list.size() > 0) {
            login = (Login) list.get(0);
        }
        return login;
    }
}
